package com.mjk.common.vo;

import java.util.List;

public class TableResponse<T> extends BaseResponse {

	TableData<T> data;
	
	public TableResponse(long total, List<T> rows){
		this.data = new TableData<T>(total, rows);
	}
	
	public TableResponse(){
		this.data = new TableData<T>();
	}


	TableResponse<T> data(int total){
		this.data.setTotal(total);
		return this;
	}
	
	TableResponse<T> data(List<T> rows){
		this.data.setRows(rows);
		return this;
	}
	

	public TableData<T> getData() {
		return data;
	}

	class TableData<T>{
		long total;
		List<T> rows;
		
		public TableData(long total, List<T> rows){
			this.total = total;
			this.rows = rows;
		}
		
		public TableData(){}

		public long getTotal() {
			return total;
		}

		public void setTotal(long total) {
			this.total = total;
		}

		public List<T> getRows() {
			return rows;
		}

		public void setRows(List<T> rows) {
			this.rows = rows;
		}
	}
}
